/*

	CStaticMesh.h
	
	Class derived from IMesh used for static
	meshes. Uses OpenGL display lists to improve
	rendering performance for meshes with no
	animations.
	
	Written by Sigurd Suhm 2009

*/

#ifndef _CSTATICMESH_H
#define _CSTATICMESH_H

// Includes
#include "IMesh.h"		// IMesh interface header

#ifdef _WIN32
#include <windows.h>		// Include windows header on the windows platform
#endif
#include <GL/gl.h>		// OpenGL header

namespace EraAstral
{
	namespace graphics
	{
		class StaticMesh : public IMesh
		{
			private:
				// Index of the OpenGL display list
				GLuint	dispListIndex;
				// Index of the OpenGL texture
				GLuint	textureIndex;
		
			public:
				// Static mesh constructor
				StaticMesh();
				// Constructor creating mesh from vertex, normal, tex coord and index data
				StaticMesh(Vector3 **vertices, Vector3 **normals, Vector2 **texCoords, IndexStruct **indices,
							unsigned int vertexCount, unsigned int normalCount, unsigned int texCoordCount, 
							unsigned int indexCount);
				// Static mesh destructor
				~StaticMesh();
				
				// Loads a texture for the mesh from a file
				int		LoadTexture(const char *fileName);
				
				// Commits changes in the mesh to OpenGL
				int Commit();
				// Draw method - Override from IMesh
				void Draw();
				
				// Friend functions
				friend StaticMesh *CreateBoxMesh(float, float, float);
		};
	}
}

#endif		// _CSTATICMESH_H
